package gestion.camping.vue;

import gestion.camping.utils.MessagesUtil;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;

public class ViewErreur extends JDialog implements ActionListener {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5453229815909209649L;

	private JButton btnOk;
	
	/**
	 * Create the dialog.
	 */
	public ViewErreur(String message){
		setBounds(500, 300, 400, 200);
		setModal(true);
		
		btnOk= new JButton(MessagesUtil.formatMessage("erreur.btn.ok"));
		btnOk.setSize(40, 20);
		btnOk.addActionListener(this);
		getContentPane().add(btnOk, BorderLayout.SOUTH);
		
		JLabel lblMsg = new JLabel(message);
		getContentPane().add(lblMsg, BorderLayout.CENTER);

	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == btnOk){
			this.dispose();
		}
	}

}
